package com.cv.platform.controller.system.carousel;

import com.cv.framework.common.pojo.Result;
import com.cv.platform.controller.platform.carousel.vo.CvVideoCarouselRespVO;
import com.cv.platform.controller.system.carousel.vo.CvVideoCarouselSaveReqVO;
import com.cv.platform.service.carousel.CvVideoCarouselService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 后台管理系统 - 轮播图控制层
 *
 * @author Charles_XDXD
 */
@Tag(name = "后台管理系统 - 轮播图控制层")
@RestController
@RequestMapping("/platform/video/carousel")
public class SystemVideoCarouselController {

    @Resource
    private CvVideoCarouselService cvVideoCarouselService;

    @PostMapping("save")
    public Result<Void> save(@RequestBody CvVideoCarouselSaveReqVO reqVO) {
        cvVideoCarouselService.insertOrUpdate(reqVO);
        return Result.success();
    }
    
    @DeleteMapping("delete")
    @Operation(summary = "删除视频轮播图")
    public Result<Void> deleteCarousel(Long id) {
        cvVideoCarouselService.deleteCarousel(id);
        return Result.success();
    }

    @GetMapping("list")
    @Operation(summary = "获取视频轮播图列表（视频平台 - 展示轮播图）")
    public Result<List<CvVideoCarouselRespVO>> list() {
        return Result.success(cvVideoCarouselService.getAllList());
    }

}
